package com.cwrl.spider.server.test.flow.price.node;

import com.cwrl.spider.server.test.flow.price.PriceContext;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author cw
 */
@LiteflowComponent(value = "priceInitNode", name = "初始化价格")
public class PriceInitNodeComponent extends NodeComponent {
    @Override
    public void process() throws Exception {
        String total = this.getRequestData();
        PriceContext contextBean = this.getContextBean(PriceContext.class);
        if (contextBean != null) {
            contextBean.setTotalPrice(new BigDecimal(total));
            List<String> list = new ArrayList<>();
            list.add("20");
            list.add("40");
            contextBean.setList(list);
        }
    }
}
